import React from 'react';
import { WingBlank } from 'antd-mobile';
import { Button, Typography } from 'antd';
import styles from './index.module.css';
import { connect, ConnectProps, UserModelState } from 'umi';

interface LoginlProps extends ConnectProps {
    user: UserModelState;
}

const { Title, Text } = Typography;

const Login: React.FC<LoginlProps> = ({ user }) => {
    const handleClickLogin = () => {
        window.location.href =
            'http://cdwy.yhkamani.com/wechat/oauth2.aspx?redirect=http://cdwy.yhkamani.com/';
    };
    return (
        <>
            <WingBlank>
                <WingBlank>
                    <div className={styles['login-box']}>
                        <Title level={2}>
                            <svg
                                className="icon"
                                aria-hidden="true"
                                style={{
                                    fontSize: '40px',
                                    marginRight: '10px',
                                }}
                            >
                                <use xlinkHref="#icon-Repair" />
                            </svg>
                            欢迎使用玖德
                        </Title>
                        <div style={{ width: '100%' }}>
                            <Button
                                onClick={handleClickLogin}
                                block
                                style={{
                                    marginTop: '6.6667vw',
                                    backgroundColor: '#FB870C',
                                    color: '#fff',
                                    height: '12vw',
                                    fontSize: '6vw',
                                }}
                            >
                                微信登陆
                            </Button>
                        </div>
                        {/* <Text style={{ marginTop: '4.2667vw', color: '#999' }}>
                            点击开始, 即表示已阅读同意{' '}
                            <Text style={{ color: 'blue' }}>《xxxx协议》</Text>
                        </Text> */}
                    </div>
                </WingBlank>
            </WingBlank>
        </>
    );
};

export default connect(({ user }: { user: UserModelState }) => ({
    user,
}))(Login);
